﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zeus.Thunder.Core;

namespace SharpTrainer.FileStreams
{
    class StreamReaderWriterTest : ITestCase
    {
        public void Run()
        {
            using (FileStream fs = File.Create ("stream_test.txt"))
            using (TextWriter writer = new StreamWriter (fs))
            {
                writer.WriteLine ("Line1");
                writer.WriteLine ("Line2");
                writer.WriteLine("你好");
            }

            using (FileStream fs = File.OpenRead("stream_test.txt"))
            using (TextReader reader = new StreamReader (fs))
            {
                Console.WriteLine (reader.ReadLine()); // Line1
                Console.WriteLine(reader.ReadLine()); // Line2
                Console.WriteLine(reader.ReadLine()); // Line3
            }
        }
    }
}
